package main

import (
	"fmt"
	"math"
)

const (
	qq, ww = 1, 2
)

func consts() {
	const filename string = "abc.txt"
	const a, b = 3, 4 // 常量不指定类型，可以认为是文本替换，可以是int，可以是float
	var c int
	c = int(math.Sqrt(a*a + b*b))
	fmt.Println(filename, c)
}

func enums() {
	// 枚举
	//const (
	//	cpp    = 0
	//	java   = 1
	//	python = 2
	//	golang = 3
	//)
	//fmt.Println(cpp, java, python, golang)

	// better
	const (
		cpp = iota
		_
		python
		golang
		javascript
	)

	fmt.Println(cpp, javascript, python, golang)

	// b, kb, mb, gb, tb, pb
	const (
		b = 1 << (10 * iota)
		kb
		mb
		gb
		tb
		pb
	)
	fmt.Println(b, kb, mb, gb, tb, pb)
}

func main() {
	consts()
	enums()
}
